import request from "@/utils/request"
import { type RuleForm } from "@/views/education/subject-edit.vue";

// 请求参数类型
type SubjectParamsType = {
    level: number | string;
    pageIndex: number;
    pageSize: number
}
// 
type SubjectResponseType<T> = {
    total: number;
    list: T[]
}

// 返回值类型
export type SubjectType = {
    id: number;
    name: string;
    level: number;
    levelName: string
}

export function subjectPage(data: SubjectParamsType) {
    return request.post<SubjectResponseType<SubjectType>>("/api/admin/education/subject/page", data)
}
export function subjectEdit(data: RuleForm) {
    return request.post('/api/admin/education/subject/edit', data)
}
export function subjectSelect(id: any) {
    return request.post<SubjectType>('/api/admin/education/subject/select/' + id)
}
export function subjectDelete(id: number) {
    return request.post('/api/admin/education/subject/delete/' + id)
}